<template>
  <div class="header-user-info">
    <div class="float-right">
      <div class="d-inline-block v-t">
        <img :src="value.figureUrl"
             class="figure rounded-circle"/>
      </div>
      <div class="d-inline-block v-t">
        <el-menu mode="horizontal">
          <el-submenu index="login-20">
            <template slot="title">{{value.nickName}}</template>
            <el-menu-item index="login-21" @click="to('/shop/help.html')"><i class="fa fa-info-circle"></i> 帮助
            </el-menu-item>
            <el-menu-item index="login-22" @click="logout('/shop/logout.html')"><i class="fa fa-sign-out"></i> 退出
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </div>
    </div>
  </div>
</template>
<script>
  import {http} from '../../../service/common'

  export default {
    name: 'HLoginInfo',
    data() {
      return {}
    },
    props: {
      value: {
        type: Object
      }
    },
    methods: {
      to: function (url) {
        this.$router.push(url)
      },
      logout: function (url) {
        const me = this
        http.post(url).then(ds => {
          me.$router.push('/shop/login.html')
        })
      }
    }
  }
</script>
